package com.aqie.demo.filter_and_interceptor;


import com.aqie.demo.http_request_response.UserIdInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 注册 Interceptor
 */
/*@Component
@Configuration*/
public class WebInterceptorAdapter implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(new LogInterceptor()).addPathPatterns("/**").order(0);
        registry.addInterceptor(new UpdateLogInterceptor())
                .addPathPatterns("/**").order(1);

        // 导致获取不到post json数据
        registry.addInterceptor(new UserIdInterceptor()).addPathPatterns("/**")
                .order(3);
    }
}
